package xyz.xpman.prisonerfitness.kit;

import android.content.Context;
import android.content.Intent;

import org.jetbrains.annotations.NotNull;

import xyz.xpman.prisonerfitness.share.IFileModel;
import xyz.xpman.prisonerfitness.share.ITextModel;

public class ShareKit {

    private ShareKit() { }


    public static void file(@NotNull Context context,
                            @NotNull IFileModel attrs) {
        Intent intent = new Intent();
        intent.setAction(Intent.ACTION_SEND);
        intent.putExtra(Intent.EXTRA_STREAM, attrs.getUri());
        // 文件mimeType，如"image/*"
        intent.setType(attrs.getType());

        context.startActivity(Intent.createChooser(intent, attrs.getTips()));
    }


    public static void text(@NotNull Context context,
                            @NotNull ITextModel attrs) {
        Intent intent = new Intent();
        intent.setAction(Intent.ACTION_SEND);
        intent.putExtra(Intent.EXTRA_SUBJECT, attrs.getTitle());
        intent.putExtra(Intent.EXTRA_TEXT, attrs.getContent());
        // 文件mimeType，如"image/*"
        intent.setType(attrs.getType());

        context.startActivity(Intent.createChooser(intent, attrs.getTips()));
    }

}
